package com.sgb.kjwl.view.ui.adapter.packers;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.PackersTeamEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.MDateUtil;

import java.util.List;

/**
*@author 毁灭霸者
*@date 2019/6/5
*description:
*/
public class PackersTeamAdapter extends BaseRecycleAdapter<PackersTeamEntity> {

    public PackersTeamAdapter(Context context, List<PackersTeamEntity> data) {
        super(context, R.layout.item_packers_team, data);
    }

    @Override
    public void convert(ItemViewHolder holder, final PackersTeamEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        TextView timeView = holder.getItem().findViewById(R.id.time_view);
        try {
            timeView.setText(MDateUtil.getByTimestamp(Long.parseLong(entity.getTime()), MDateUtil.Format.FORMART5.name));
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }
}
